{
LANG : PASCAL
PROB : evenodd
ID : phamnamlo2
}

program evenodd;
const
  fi = 'evenodd.in';
  fo = 'evenodd.out';
var
  a : array[0..1] of longint;
  n : longint;

procedure inp;
begin
  read(n);
end;

procedure process;
var
  x : longint;
begin
  while n > 0 do
  begin
    read(x);
    inc(a[x mod 2], x);
    dec(n);
  end;
end;

procedure out;
begin
  writeln(a[0], ' ', a[1]);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);

  inp;
  process;
  out;

  close(output);
  close(input);
end.
